package com.cbtx.module.base.http;

import java.lang.reflect.ParameterizedType;

/**
 * 请求接口回调
 * @param <T> 返回的对象
 */
public abstract class MyRequestCallBack<T> {
	private Class<T> clazz;
	public Object tag;

	public Object getTag() {
		return tag;
	}

	public void setTag(Object tag) {
		this.tag = tag;
	}

	@SuppressWarnings("unchecked")
	public MyRequestCallBack() {
		ParameterizedType type = (ParameterizedType) getClass()
				.getGenericSuperclass();
		clazz = (Class<T>) type.getActualTypeArguments()[0];
	}

	public Class<T> getClazz() {
		return clazz;
	}

	public abstract void onSuccess(T obj);

	public abstract void onFailure(int error, String msg);

	public void onStart() {
	}

	public void onLoading(long total, long current, boolean isUploading) {
	}
}
